Hi Laura!
This question pertains to the Sensor Custom Unit that I described
in this thread
Just recapping the important bit:
My research project is to create a generic design pattern to easily define and include Stigmergy into web pages. Ideally the implementation will be completely encapsulated in Custom Units. There are two types of Custom Units and they display one of two variations when they instantiate themselves:
- Actuator Custom Unit (instantiates as Marker Based or Sematectonic) creates the "trail" and
- Sensor Custom Unit (instantiates as Quantitative or Qualitative) displays the trail.
This question is only about the Sensor Custom Unit. It's a standard design Custom Unit with a service java class and a bean java class. It creates a record in the Contribution database table is two ways; one for Marker Based, one for Sematectonic.
NOTE : The Sensor can provide Quantitative output (number of "Likes" or "Seen By" or Qualitative output (similar to Facebook "Share" where it displays some linked content ... or Amazon "People who bought this also bought ...". Getting the Qualitative output is the issue I'm trying to solve for the Sensor Unit.
The Quantitative instantiation is working where a single text value is provided (E.g., "SELECT COUNT(*) WHERE ..." provides the number of "Likes"). This is easily displayed using:
<c:if test="${<wr:UnitId/>.isQuantitative}">
<tr class="row">
<td valign="middle" nowrap="nowrap" class=" value">
<c:out value="${<wr:UnitId/>.contributionOutput}"/>
</td>
</tr>
</c:if>
If the instantiation is Qualitative, then the style unit it can offer one or more Urls (or text descriptions) where the java bean returns a map with an Oid/URL Map. So the WR:Iterator you describe really needs to be replaced with something like:
<c:if test="${!<wr:UnitId/>.isQuantitative}">
<th valign="middle" class=" header">
<c:out value="${<wr:UnitId/>.signOutputLabel}"/>
</th>
<c:forEach var="contribution" items="${<wr:UnitId/>.contributions}">
<td class="<wr:StyleClass/> value....">
<a target="_blank" class=" " href="<c:out value="${contribution.value}"/>">
<img src="<path>" title="<c:out value="${contribution.value}"/>"/>
</a> // prints the link as an image
<wr:Value/> // prints the link as a text
</td>
</c:forEach>
</c:if>
The Problem:
I haven't gotten this code working yet, but if you could suggest whether my "c:ForEach" will work at run-time the same as your suggested "wr:Iterate". From our previous discussion
I thought that the "wr" tags resolved to groovy script equivalents and we established that these are processed at page generation time (not run-time)? In that case I anticipate that your suggested solution would not work for my example.
Secondly, I was hoping to get some kind of preview (like Facebook does for "Share" content as thumbnails) and wonder if there is a feature to do that?
Either way, getting the Custom Unit's Style Unit to be able to iterate through the Map as returned by the java bean (for the Custom Unit) is my primary goal. I'll work this weekend to try and get it compiled and returning a list this weekend, but if my approach is incorrect I'd love to hear that before I "lose" my weekend. ;p
Again, all help gratefully appreciated thank you!